**# Preample

clear all
cd "INSERTPATH" 														// Remember to update file directory ("INSERTPATH")
use  "data_S2.dta", clear 												// Remember to update file directory ("INSERTPATH") in cd above
set scheme plotplain
 
 
**# App. D.2  

* Covariate balance: 
gen strong_pid = 0 
replace strong_pid = 1 if pid_strength == 3
gen mod_pid = 0 
replace mod_pid = 1 if pid_strength == 2

gen female = 0 
replace female = 1 if gender == 0

gen rep = 0 
replace rep = 1 if pid == 2

foreach var in female rep strong_pid mod_pid age {
	ttest `var',  by(D) unequal	
}
 
* Manipulation check: perceived electoral legitimacy 
gen election_fair = (pei-1)/4
reg election_fair i.condition i.pid, rob

* Manipulation check: treatment recall
tab treatment_recall 													// 95.7 % of respondents correctly recall topic of vignette. 
reg treatment_recall i.condition i.pid, rob 							// No significant differences in recall across experimental arms. 


**# App. E.2
use  "data_S2.dta", clear 												// Remember to update file directory ("INSERTPATH") in cd above
  
gen support_inparty =  inparty_affect/10 
gen support_outparty = outparty_affect/10
gen aff_pol = inparty_affect-outparty_affect
gen affective_polarization = (aff_pol+10)/20


reg vote_outparty i.condition i.pid, rob
reg support_inparty i.condition i.pid, rob
reg support_outparty i.condition i.pid, rob
reg affective_polarization i.condition i.pid, rob 

**# App. F.2
use  "data_S2.dta", clear 												// Remember to update file directory ("INSERTPATH") in cd above
  
gen support_inparty =  inparty_affect/10 
gen support_outparty = outparty_affect/10
gen aff_pol = inparty_affect-outparty_affect
gen affective_polarization = (aff_pol+10)/20

reg election i.condition i.pid, rob
reg support_inparty i.condition i.pid, rob
reg vote_inparty i.condition i.pid, rob
reg affective_polarization i.condition i.pid, rob
reg support_outparty i.condition i.pid, rob
reg vote_outparty i.condition i.pid, rob
reg vote_independent i.condition i.pid, rob

**# App. G.2
use  "data_S2.dta", clear 												// Remember to update file directory ("INSERTPATH") in cd above
eststo clear
reg support_inparty i.condition i.pid if attention!=0, rob  
reg vote_inparty i.condition i.pid if attention!=0, rob
reg affective_polarization i.condition i.pid if attention!=0, rob
reg support_outparty i.condition i.pid if attention!=0, rob
reg vote_outparty i.condition i.pid if attention!=0, rob
reg vote_independent i.condition i.pid if attention!=0, rob


**# App. H.2
use  "data_S2.dta", clear 												// Remember to update file directory ("INSERTPATH") in cd above
gen leaner = 0 
replace leaner = 1 if pid_strength == 1

reg support_inparty i.condition i.pid if leaner!=1, rob 
reg vote_inparty i.condition i.pid if leaner!=1, rob 
reg affective_polarization i.condition i.pid if leaner!=1, rob 
reg support_outparty i.condition i.pid if leaner!=1, rob 
reg vote_outparty i.condition i.pid if leaner!=1, rob 
reg vote_independent i.condition i.pid if leaner!=1, rob 


**# App. I 
use  "data_S2.dta", clear 												// Remember to update file directory ("INSERTPATH") in cd above

* Makes a series of identical treatment variables (used to plot findings using "coefplot")
gen X1 = D
gen X2 = D
gen X3 = D
gen X4 = D
gen X5 = D
gen X6 = D


* Estimates and store models for misinformation among election believers (those who don't believe in Trump allegations): 
eststo clear

eststo m1: qui reg support_inparty i.X1 i.pid if fraud_belief_D==0 & condition!=2, rob  
eststo m2: qui reg vote_inparty i.X2 i.pid if fraud_belief_D==0 & condition!=2, rob  
eststo m3: qui reg affective_polarization i.X3 i.pid if fraud_belief_D==0 & condition!=2, rob     
eststo m4: qui reg support_outparty i.X4 i.pid if fraud_belief_D==0 & condition!=2, rob     
eststo m5: qui reg vote_outparty i.X5 i.pid if fraud_belief_D==0 & condition!=2, rob   
eststo m6: qui reg vote_independent i.X6 i.pid if fraud_belief_D==0 & condition!=2, rob     

* Estimate and store models for gerrymandering among election believers:
eststo m7: qui reg support_inparty i.X1 i.pid if fraud_belief_D==0 & condition!=1, rob  
eststo m8: qui reg vote_inparty i.X2 i.pid if fraud_belief_D==0 & condition!=1, rob  
eststo m9: qui reg affective_polarization i.X3 i.pid if fraud_belief_D==0 & condition!=1, rob     
eststo m10: qui reg support_outparty i.X4 i.pid if fraud_belief_D==0 & condition!=1, rob     
eststo m11: qui reg vote_outparty i.X5 i.pid if fraud_belief_D==0 & condition!=1, rob   
eststo m12: qui reg vote_independent i.X6 i.pid if fraud_belief_D==0 & condition!=1, rob     


coefplot (m1 m2 m3 m4 m5 m6, label("Misinformation") mcolor(black) mlabcolor(black) msymbol(O) msize(medlarge) ciopts(lcolor(black) recast(rspike))) ///
   (m7 m8 m9 m10 m11 m12, label("Gerrymandering") mcolor(black) mfcolor(white) mlabcolor(black) msymbol(O) msize(medlarge) ciopts(lcolor(black) recast(rspike))) ///
   , drop(_cons 1.pid 2.pid) ///
   xline(0, lcolor(gs10%75) lpattern(solid)) ///
   graphregion(fcolor(white)) ///
   xlabel(-.4 -.2 0 .2,notick nogrid) ///
   xtitle("Treatment Effect") ///
   xscale(range(-.5/.25)) ///
   ylabel() ///
   coeflabels( ///
   1.X1 = "In-Party Affect" ///
   1.X2 = "Propensity to Vote In-Party" ///
   1.X3 = "Net In-Party Favorability" ///
   1.X4 = "Out-Party Affect" ///
   1.X5 = "Propensity to Vote Out-Party" ///
   1.X6 = "Propensity to Vote Independent", labsize(medsmall)) ///
   headings( ///
   1.X1 = "{bf: In-Party Support}" ///
   1.X4 = "{bf: Out-Party Support}", labsize(medsmall)) ///
   title("{bf:A}		Election Believers", size(large) justification(left) span pos(11))  ///
   name(believers)

   

* Estimate and store models for misinformation among election deniers (those who  believe in Trump allegations): 
eststo clear
eststo m1: qui reg support_inparty i.X1 i.pid if fraud_belief_D==1 & condition!=2, rob  
eststo m2: qui reg vote_inparty i.X2 i.pid if fraud_belief_D==1 & condition!=2, rob  
eststo m3: qui reg affective_polarization i.X3 i.pid if fraud_belief_D==1 & condition!=2, rob     
eststo m4: qui reg support_outparty i.X4 i.pid if fraud_belief_D==1 & condition!=2, rob     
eststo m5: qui reg vote_outparty i.X5 i.pid if fraud_belief_D==1 & condition!=2, rob   
eststo m6: qui reg vote_independent i.X6 i.pid if fraud_belief_D==1 & condition!=2, rob     

* Estimate and store models for gerrymandering among election deniers:
eststo m7: qui reg support_inparty i.X1 i.pid if fraud_belief_D==1 & condition!=1, rob  
eststo m8: qui reg vote_inparty i.X2 i.pid if fraud_belief_D==1 & condition!=1, rob  
eststo m9: qui reg affective_polarization i.X3 i.pid if fraud_belief_D==1 & condition!=1, rob     
eststo m10: qui reg support_outparty i.X4 i.pid if fraud_belief_D==1 & condition!=1, rob     
eststo m11: qui reg vote_outparty i.X5 i.pid if fraud_belief_D==1 & condition!=1, rob   
eststo m12: qui reg vote_independent i.X6 i.pid if fraud_belief_D==1 & condition!=1, rob     
   
coefplot (m1 m2 m3 m4 m5 m6, label("Misinformation") mcolor(black) mlabcolor(black) msymbol(O) msize(medlarge) ciopts(lcolor(black) recast(rspike))) ///
   (m7 m8 m9 m10 m11 m12, label("Gerrymandering") mcolor(black) mfcolor(white) mlabcolor(black) msymbol(O) msize(medlarge) ciopts(lcolor(black) recast(rspike))) ///
   , drop(_cons 1.pid 2.pid) ///
   xline(0, lcolor(gs10%75) lpattern(solid)) ///
   graphregion(fcolor(white)) ///
   xlabel(-.4 -.2 0 .2,notick nogrid) ///
   xtitle("Treatment Effect") ///
   xscale(range(-.5/.25)) ///
   ylabel() ///
   coeflabels( ///
   1.X1 = "In-Party Affect" ///
   1.X2 = "Propensity to Vote In-Party" ///
   1.X3 = "Net In-Party Favorability" ///
   1.X4 = "Out-Party Affect" ///
   1.X5 = "Propensity to Vote Out-Party" ///
   1.X6 = "Propensity to Vote Independent", labsize(medsmall)) ///
   headings( ///
   1.X1 = "{bf: In-Party Support}" ///
   1.X4 = "{bf: Out-Party Support}", labsize(medsmall)) ///
   title("{bf:B}		Election Deniers", size(large) justification(left) span pos(11))  ///
   name(deniers)   
   
grc1leg2 believers deniers, rows(1) 
graph display, ysize(5) xsize(15) scale(1.2)  


**# App J 
use  "data_S2.dta", clear 												// Remember to update file directory ("INSERTPATH") in cd above
graph drop _all
eststo clear

* Rescale SM to 0-1:
gen SM_rescale = SM/12

 
* Ren estimations and store results:
reg support_inparty i.condition##c.SM_rescale i.pid, rob
reg vote_inparty i.condition##c.SM_rescale i.pid, rob
reg support_outparty i.condition##c.SM_rescale i.pid, rob
reg vote_outparty i.condition##c.SM_rescale i.pid, rob



* Plot marginal effects at 25 percentile, median, and 75 percentile:
sum SM_rescale, d
qui reg support_inparty i.condition##c.SM_rescale i.pid, rob
margins, dydx(condition) at(SM_rescale=(.25 .41 .66)) 
marginsplot, ///
   xtitle("Self-Monitoring") ///
   ytitle("Marginal Effects of Cheating on In-Party Affect") ///
   xscale(range(.20/.7)) ///
   xlabel(.25 "25% percentile" .41 "Median" .66 "75% percentile") ///
   yscale(range(-.40/.12)) ///
   ylabel(-.35 -.3 -.25 -.2 -.15 -.1 -.05 0 .05 .1) ///
   yline(0, lcolor(gs10%75) lpattern(solid)) ///
   title("")
  
  
  
**# App. K  
use  "data_S2.dta", clear 												// Remember to update file directory ("INSERTPATH") in cd above  
  
reg support_inparty i.condition##c.party_social_ID i.pid, rob
reg vote_inparty i.condition##c.party_social_ID i.pid, rob
reg support_outparty i.condition##c.party_social_ID i.pid, rob
reg vote_outparty i.condition##c.party_social_ID i.pid, rob


**# App. M
use  "data_S2.dta", clear 												// Remember to update file directory ("INSERTPATH") in cd above  

qui reg vote_inparty i.condition i.pid, rob
qui margins condition
mat A = r(table)

qui reg vote_outparty i.condition i.pid, rob
qui margins condition
mat B = r(table)

qui reg vote_independent i.condition i.pid, rob
qui margins condition
mat C = r(table)


mat P = 0,0,0,A[1,1],A[5,1],A[6,1]\		///
		1,0,.3,A[1,2],A[5,2],A[6,2]\	///
		2,0,.6,A[1,3],A[5,3],A[6,3]\	///
		0,1,0,B[1,1],B[5,1],B[6,1]\		///
		1,1,.3,B[1,2],B[5,2],B[6,2]\	///
		2,1,.6,B[1,3],B[5,3],B[6,3]\	///
		0,2,0,C[1,1],C[5,1],C[6,1]\		///
		1,2,.3,C[1,2],C[5,2],C[6,2]\	///
		2,2,.6,C[1,3],C[5,3],C[6,3]
	
		
frame create plot1
cwf plot1		
svmat P
rename P1 condition
rename P2 outcome
rename P3 Xpos
rename P4 b
rename P5 ll
rename P6 ul	


tw ///
	(bar b Xpos if condition == 0, mlab(b) mlabformat(%5.2fc) mlabposition(12) mlabcolor(black) mlabgap(2) ///
	barw(.15) col(black) fcol(white) by(outcome, title("") note("") legend(off) rows(1))) ///
	(bar b Xpos if condition == 1, mlab(b) mlabformat(%5.2fc) mlabposition(12) mlabcolor(black) mlabgap(2) ///
	barw(.15) col(black) fcol(black) by(outcome)) ///
	(bar b Xpos if condition == 2, mlab(b) mlabformat(%5.2fc) mlabposition(12) mlabcolor(black) mlabgap(2) ///
	barw(.15) col(gs12) fcol(gs12) by(outcome)) ///
	(rspike ll ul Xpos, lcolor(black)) ///
	, xscale(range(0 .7) lc(none)) ///
	xlab(0 "Control" .3 `" "Mis-" "information" "'.6 `" "Gerry-" "mandering"  "', notick nogrid labsize(small)) ///
	yscale(range(0 1) lc(none)) ylab(0 .2 .4 .6 .8 1, notick nogrid) ytit("Vote Share") yline(.5) ///
	xtit("Treatment Status") ///
	plotregion(lcolor(black) lwidth(medium)) ///
	name(S2_vote_share, replace)


**# App. N 
use  "data_S2.dta", clear 												// Remember to update file directory ("INSERTPATH") in cd above  


* make & rescale variables
gen support_inparty =  inparty_affect/10 
gen support_outparty = outparty_affect/10
gen aff_pol = inparty_affect-outparty_affect
gen affective_polarization = (aff_pol+10)/20



* Plot X, S2:
frame rename default data
qui reg support_inparty i.D if condition!=2 & pid==1, rob	// Misinformation & Democrat
mat B1 = r(table)
qui reg support_inparty i.D if condition!=2 & pid==2, rob	// Misinformation & Republican
mat B2 = r(table)
qui reg support_inparty i.D if condition!=1 & pid==1 , rob 	// Gerrymandering & Democrat
mat B3 = r(table)
qui reg support_inparty i.D if condition!=1 & pid==2, rob	// Gerrymandering & Republican
mat B4 = r(table)

qui reg support_outparty i.D if condition!=2 & pid==1, rob
mat C1 = r(table)
qui reg support_outparty i.D if condition!=2 & pid==2, rob
mat C2 = r(table)
qui reg support_outparty i.D if condition!=1 & pid==1, rob
mat C3 = r(table)
qui reg support_outparty i.D if condition!=1 & pid==2, rob
mat C4 = r(table)

qui reg affective_polarization i.D if condition!=2 & pid==1, rob
mat D1 = r(table)
qui reg affective_polarization i.D if condition!=2 & pid==2, rob
mat D2 = r(table)
qui reg affective_polarization i.D if condition!=1 & pid==1, rob
mat D3 = r(table)
qui reg affective_polarization i.D if condition!=1 & pid==2, rob
mat D4 = r(table)





mat H = 0,.81,B1[1,2],B1[5,2],B1[6,2],0\ 	///
		0,.79,B2[1,2],B2[5,2],B2[6,2],1\	///
		0,.76,C1[1,2],C1[5,2],C1[6,2],0\ 	///
		0,.74,C2[1,2],C2[5,2],C2[6,2],1\ 	///
		0,.71,D1[1,2],D1[5,2],D1[6,2],0\ 	///
		0,.69,D2[1,2],D2[5,2],D2[6,2],1
		


* make Panel A: 
frame create plot1
cwf plot1		
svmat H
rename H1 condition 	// 0  = Misinformation, 1 = Gerrymandering
rename H2 Ypos
rename H3 b
rename H4 ll
rename H5 ul
rename H6 pid			// 0 = democrat, 1 = republican

tw ///
	(rspike ll ul Ypos if pid == 0, horizontal lcolor("10 117 173")) ///
	(rspike ll ul Ypos if pid == 1, horizontal lcolor("255 64 64")) ///
	(scatter Ypos b if pid == 0, msym(O) mc("10 117 173") msize(med)) ///
	(scatter Ypos b if pid == 1, msym(D) mc("255 64 64") msize(med)) ///
	, yscale(range(.69 .85) lc(none)) ytit("") ///
	ylab(.83 "{bf:Party Attachments}" .8 "In-Party Affect" .75 "Out-Party Affect" .7 "Affective Polarization", notick nogrid) ///
	xtit("Treatment Effect") xscale(range(-.35 .25) lc(none)) xlab(-.3 -.2 -.1 0 .1 .2, notick nogrid) xline(0) ///
	legend(off) plotregion(lcolor(black) lwidth(medium)) ///
	title("{bf:A} Misinformation", size(medsmall) justification(left) pos(11)) ///
	name(S2_affect_pid_A, replace)

* Panel B:
mat I = 1,.81,B3[1,2],B3[5,2],B3[6,2],0\ 	///
		1,.79,B4[1,2],B4[5,2],B4[6,2],1\	///
		2,.76,C3[1,2],C3[5,2],C3[6,2],0\ 	///
		2,.74,C4[1,2],C4[5,2],C4[6,2],1\ 	///
		3,.71,D3[1,2],D3[5,2],D3[6,2],0\ 	///
		3,.69,D4[1,2],D4[5,2],D4[6,2],1



frame create plot2
cwf plot2		
svmat I
rename I1 outcome
rename I2 Ypos
rename I3 b
rename I4 ll
rename I5 ul
rename I6 pid		

tw ///
	(rspike ll ul Ypos if pid == 0, horizontal lcolor("10 117 173")) ///
	(rspike ll ul Ypos if pid == 1, horizontal lcolor("255 64 64")) ///
	(scatter Ypos b if pid == 0, msym(O) mc("10 117 173") msize(med)) ///
	(scatter Ypos b if pid == 1, msym(D) mc("255 64 64") msize(med)) ///
	, yscale(range(.69 .85) lc(none)) ytit("") ///
	ylab(none, notick nogrid) ///
	xtit("Treatment Effect") xscale(range(-.25 .25) lc(none)) xlab(-.2 -.1 0 .1 .2, notick nogrid) xline(0) ///
	plotregion(lcolor(black) lwidth(medium)) ///
	title("{bf:B} Gerrymandering", size(medsmall) justification(left) pos(11)) ///
	legend(label(3 "Democrats") label(4 "Republicans") order(3 4) row(2) pos(4)) ///
	aspect(.55,place(w)) ///
	name(S2_affect_pid_B, replace)
		

graph combine S2_affect_pid_A S2_affect_pid_B, rows(1) ycommon 
graph display, xsize(8) ysize(2.5) scale(2.5)


	